<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>北京联合大学</title>
</head>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_835526_xufba1hg66.css">
<link rel="stylesheet" href="../../css/Initialization.css">
<link rel="stylesheet" href="../../css/commen.css">
<link rel="stylesheet" href="../../css/createdteam.css">
<body>
<div id="content">
    <div class="initer">
            <!-- 具体内容 -->
            <div class="bread">
                <div class="plain">
                    我的信息
                </div>
                <div class="plain">
                    <i class="iconfont icon-right"></i>
                </div>
                <div class="plain">
                    小组信息
                </div>
                <div class="plain">
                    <i class="iconfont icon-right"></i>
                </div>
                <div class="plain current">
                    创建小组
                </div>
            </div>
            <div class="teamform">
                <div class="teamtitle">
                    小组名称
                </div>
                <div class="teaminput">
                    <input type="text" placeholder="请输入小组名称" class="name" name="groupname" id="groupname">
                </div>
                <div class="teamtitle">
                    小组说明
                </div>
                <div  class="teaminput">
                    <!-- <input type="text" placeholder="请输入小组说明"> -->
                    <textarea  placeholder="请输入小组说明" class="desc" name="groupintro" id="groupintro"></textarea>
                </div>
                <div class="createbtn">
                    <div class="center-button" id="subBut">
                        创建小组
                    </div>
                </div>
            </div>
            <div class="h50"></div>
        </div>
</div>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/commen.js"></script>
<script>
    $(function(){
        $("#subBut").click(function(){
            var groupname = $("#groupname").val();
            var groupintro = $("#groupintro").val();
            if(groupname.length == 0){
                alert("请输入小组名称");
                $("#groupname").focus();
                return false;
            }else if(groupintro.length == 0){
                alert("请输入小组说明");
                $("#groupintro").focus();
                return false;
            }else{
                $.ajax({
                    type : "POST",
                    url : "saveGroup",
                    data : {groupname: groupname, groupintro: groupintro},
                    dataType : "json",
                    success : function(json) {
                        if(json.state == error){
                            alert(json.result);
                        }else{
                            alert(json.result);
                            location.href = "../person/information"
                        }
                    },
                    error:function(msg){
                        alert("程序出错，请联系管理员");
                    }
                });
            }
        });
    });
</script>
</body>
</html>

